FROM pch18/baota:clear
MAINTAINER biebbwa@163.com

# 设置构建参数
# mysql 版本
ARG MYSQL_VERSION=5.6
# php 版本
ARG PHP_VERSION=7.0
# nginx 版本
ARG NGINX_VERSION=1.20
# mysql root 密码
ARG MYSQL_USERNAME=root
ARG MYSQL_ROOT_PASSWORD=123456
# 宝塔 账号
ARG BAOTA_USERNAME=biebbwa
# 宝塔 密码
ARG BAOTA_PASSWORD=123456
# 0编译安装 1急速安装
ARG INSTALL_METHOD=1
## 需要修改的ip
#ARG THIS_IP=192.168.2.208

#ADD  game.tar.gz /
#COPY init.sql /home
#COPY init_ip.sh /home

RUN chmod -R 777 /home && \
    chmod -R 777 /root && \
    chmod -R 777 /www && \
    rm -rf /www/server/panel/data/bind.pl && \
    #急速安装 php      0编译安装 1急速安装   建议 编译安装
    bash /www/server/panel/install/install_soft.sh ${INSTALL_METHOD} install php ${PHP_VERSION} && \
    #急速安装 mysql
    bash /www/server/panel/install/install_soft.sh ${INSTALL_METHOD} install mysql ${MYSQL_VERSION} && \
    #急速安装 nginx
    bash /www/server/panel/install/install_soft.sh ${INSTALL_METHOD} install nginx ${NGINX_VERSION} && \
    echo '["linuxsys", "webssh", "nginx", "php-${PHP_VERSION}", "mysql"]' > /www/server/panel/config/index.json && \
    #设置mysql root密码
    cd /www/server/panel && python tools.py root ${MYSQL_ROOT_PASSWORD} && \
    #设置面板账号
    cp /www/server/panel/tools.py /www/server/panel/tools-username.py && \
    cd /www/server/panel && sed -i "s/set_panel_username()/set_panel_username(sys.argv[2])/g" "tools-username.py" && \
    cd /www/server/panel && python tools-username.py username ${BAOTA_USERNAME} && \
    rm -rf tools-username.py && \
    #设置面板密码
    cd /www/server/panel && python tools.py panel ${BAOTA_PASSWORD} && \
    # mysql 配置文件第23行追加2行配置 \n为换行
    # sed -i '23a\character_set_server = utf8\nlower_case_table_names = 1' /etc/my.cnf && \
    #设置批量执行sql脚本
#    sed -i "s/192.168.200.129/${THIS_IP}/g"  /home/root/assist_dldl/config/assist.properties && \
#    sed -i "s/192.168.200.129/${THIS_IP}/g"  /home/root/center/wow-server-center/config/game.properties && \
#    sed -i "s/192.168.200.129/${THIS_IP}/g"  /home/root/wow-server-dldl_1/config/game.properties && \
#    sed -i "s/192.168.200.129/${THIS_IP}/g"  /home/root/wow-assist/server_cfg/app_server/dldl/game.properties && \
#    sed -i "s/192.168.200.129/${THIS_IP}/g"  /home/root/wow-assist/server_cfg/app_server/dldl_1/game.properties && \
#    sed -i "s/192.168.200.129/${THIS_IP}/g"  /home/root/wow-assist/server_cfg/fight_server/dldl_center/game.properties && \
#    sed -i "s/192.168.200.129/${THIS_IP}/g"  /home/root/wow-server/config/game.properties && \
#    sed -i "s/192.168.200.129/${THIS_IP}/g"  /home/sql/assist_dldl.sql && \
    #安装server环境
    yum install -y  glibc.i686  gcc+ gcc-c++  boost-devel.x86_64 libxml2-devel.x86_64 log4cxx-devel.x86_64 jansson-devel.x86_64  git











